// **********************************************************************
//
// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

// Ice version 3.3.0

package Tracking;

public final class TruckData implements java.lang.Cloneable
{
    public String id;

    public float capacity;

    public StopData[] stops;

    public TruckData()
    {
    }

    public TruckData(String id, float capacity, StopData[] stops)
    {
        this.id = id;
        this.capacity = capacity;
        this.stops = stops;
    }

    public boolean
    equals(java.lang.Object rhs)
    {
        if(this == rhs)
        {
            return true;
        }
        TruckData _r = null;
        try
        {
            _r = (TruckData)rhs;
        }
        catch(ClassCastException ex)
        {
        }

        if(_r != null)
        {
            if(id != _r.id && id != null && !id.equals(_r.id))
            {
                return false;
            }
            if(capacity != _r.capacity)
            {
                return false;
            }
            if(!java.util.Arrays.equals(stops, _r.stops))
            {
                return false;
            }

            return true;
        }

        return false;
    }

    public int
    hashCode()
    {
        int __h = 0;
        if(id != null)
        {
            __h = 5 * __h + id.hashCode();
        }
        __h = 5 * __h + java.lang.Float.floatToIntBits(capacity);
        if(stops != null)
        {
            for(int __i0 = 0; __i0 < stops.length; __i0++)
            {
                if(stops[__i0] != null)
                {
                    __h = 5 * __h + stops[__i0].hashCode();
                }
            }
        }
        return __h;
    }

    public java.lang.Object
    clone()
    {
        java.lang.Object o = null;
        try
        {
            o = super.clone();
        }
        catch(CloneNotSupportedException ex)
        {
            assert false; // impossible
        }
        return o;
    }

    public void
    __write(IceInternal.BasicStream __os)
    {
        __os.writeString(id);
        __os.writeFloat(capacity);
        stoplistHelper.write(__os, stops);
    }

    public void
    __read(IceInternal.BasicStream __is)
    {
        id = __is.readString();
        capacity = __is.readFloat();
        stops = stoplistHelper.read(__is);
    }
}
